<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"seowonbyeong.gitee.io","root":"/","scheme":"Mist","version":"7.8.0","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="微信小程序开发记录[TOC] 前言小程序并非凭空冒出来的一个概念。当微信中的 WebView 逐渐成为移动 Web 的一个重要入口时，微信就有相关的 JS API 了。 小程序是一种全新的连接用户与服务的方式，它可以在微信内被便捷地获取和传播，同时具有出色的使用体验。 本文参照官网教程，详情请查看官网">
<meta property="og:type" content="article">
<meta property="og:title" content="微信小程序开发记录">
<meta property="og:url" content="http://seowonbyeong.gitee.io/2020/04/11/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%BC%80%E5%8F%91%E8%AE%B0%E5%BD%95/index.html">
<meta property="og:site_name" content="SeowonByeong&#39;Blogs">
<meta property="og:description" content="微信小程序开发记录[TOC] 前言小程序并非凭空冒出来的一个概念。当微信中的 WebView 逐渐成为移动 Web 的一个重要入口时，微信就有相关的 JS API 了。 小程序是一种全新的连接用户与服务的方式，它可以在微信内被便捷地获取和传播，同时具有出色的使用体验。 本文参照官网教程，详情请查看官网">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-04-11T06:22:55.417Z">
<meta property="article:modified_time" content="2020-04-09T07:08:23.065Z">
<meta property="article:author" content="SeowonByeong">
<meta property="article:tag" content="SeowonByeong">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://seowonbyeong.gitee.io/2020/04/11/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%BC%80%E5%8F%91%E8%AE%B0%E5%BD%95/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>微信小程序开发记录 | SeowonByeong'Blogs</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>
	<!-- 动态背景 -->
	
	<script type="text/javascript" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script>
	
	<!-- 左上角的图片 -->
	<a href="https://github.com/SeoWonByeong" target="_blank" rel="noopener" style="border: none;"><img style="display:inline;" width="149" height="149" 
	src="/images/forkme_left_darkblue_121621.png?resize=149%2C149" 
	class="attachment-full size-full" alt="Fork me on GitHub" data-recalc-dims="1"></a>
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">SeowonByeong'Blogs</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">SeowonByeong</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://seowonbyeong.gitee.io/2020/04/11/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%BC%80%E5%8F%91%E8%AE%B0%E5%BD%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar01.jpeg">
      <meta itemprop="name" content="SeowonByeong">
      <meta itemprop="description" content="勿忘初心 方得始终">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="SeowonByeong'Blogs">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          微信小程序开发记录
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-04-11 14:22:55" itemprop="dateCreated datePublished" datetime="2020-04-11T14:22:55+08:00">2020-04-11</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-04-09 15:08:23" itemprop="dateModified" datetime="2020-04-09T15:08:23+08:00">2020-04-09</time>
              </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h3 id="微信小程序开发记录"><a href="#微信小程序开发记录" class="headerlink" title="微信小程序开发记录"></a>微信小程序开发记录</h3><p>[TOC]</p>
<h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>小程序并非凭空冒出来的一个概念。当微信中的 WebView 逐渐成为移动 Web 的一个重要入口时，微信就有相关的 JS API 了。</p>
<p>小程序是一种全新的连接用户与服务的方式，它可以在微信内被便捷地获取和传播，同时具有出色的使用体验。</p>
<p>本文参照官网教程，详情请查看<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/quickstart/#%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%AE%80%E4%BB%8B" target="_blank" rel="noopener">官网</a></p>
<a id="more"></a>

<h1 id="一-小程序与普通网页开发的区别"><a href="#一-小程序与普通网页开发的区别" class="headerlink" title="一. 小程序与普通网页开发的区别"></a>一. 小程序与普通网页开发的区别</h1><p>​        小程序的主要开发语言是 JavaScript ，小程序的开发同普通的网页开发相比有很大的相似性。对于前端开发者而言，从网页开发迁移到小程序的开发成本并不高，但是二者还是有些许区别的。</p>
<p>​        网页开发渲染线程和脚本线程是互斥的，这也是为什么长时间的脚本运行可能会导致页面失去响应，而在小程序中，二者是分开的，分别运行在不同的线程中。网页开发者可以使用到各种浏览器暴露出来的  DOM API，进行 DOM 选中和操作。而如上文所述，小程序的逻辑层和渲染层是分开的，逻辑层运行在 JSCore  中，并没有一个完整浏览器对象，因而缺少相关的DOM API和BOM API。这一区别导致了前端开发非常熟悉的一些库，例如 jQuery、  Zepto 等，在小程序中是无法运行的。同时 JSCore 的环境同 NodeJS 环境也是不尽相同，所以一些 NPM  的包在小程序中也是无法运行的。</p>
<p>​        网页开发者需要面对的环境是各式各样的浏览器，PC 端需要面对  IE、Chrome、QQ浏览器等，在移动端需要面对Safari、Chrome以及 iOS、Android 系统中的各式 WebView  。而小程序开发过程中需要面对的是两大操作系统 iOS 和 Android  的微信客户端，以及用于辅助开发的小程序开发者工具，小程序中三大运行环境也是有所区别的</p>
<p>​        网页开发者在开发网页的时候，只需要使用到浏览器，并且搭配上一些辅助工具或者编辑器即可。小程序的开发则有所不同，需要经过申请小程序帐号、安装小程序开发者工具、配置项目等等过程方可完成</p>
<h1 id="二-准备"><a href="#二-准备" class="headerlink" title="二. 准备"></a>二. 准备</h1><h2 id="1-1-小程序帐号"><a href="#1-1-小程序帐号" class="headerlink" title="1.1 小程序帐号"></a>1.1 小程序帐号</h2><p>开发小程序的第一步，你需要拥有一个小程序帐号，通过这个帐号你就可以管理你的小程序。</p>
<p> <strong>申请帐号</strong></p>
<p>a.进入<a href="https://mp.weixin.qq.com/wxopen/waregister?action=step1" target="_blank" rel="noopener">小程序注册页</a> 根据指引填写信息和提交相应的资料，就可以拥有自己的小程序帐号。</p>
<p>b.在这个小程序管理平台，你可以管理你的小程序的权限，查看数据报表，发布小程序等操作。</p>
<p>c.登录 <a href="https://mp.weixin.qq.com" target="_blank" rel="noopener">小程序后台</a> ，我们可以在菜单 “开发”-“开发设置” 看到小程序的 <strong>AppID</strong> 了 。</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#小程序的 AppID 相当于小程序平台的一个身份证，后续你会在很多地方要用到 AppID （注意这里要区别于服务号或订阅号的 AppID）。</span></span><br></pre></td></tr></table></figure>

<h2 id="1-2-开发工具"><a href="#1-2-开发工具" class="headerlink" title="1.2 开发工具"></a>1.2 开发工具</h2><p>在 <a href="https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html" target="_blank" rel="noopener">开发者工具下载页面</a> ，根据自己的操作系统下载对应的安装包进行安装，有关开发者工具更详细的介绍可以查看 <a href="https://developers.weixin.qq.com/miniprogram/dev/devtools/devtools.html" target="_blank" rel="noopener">《开发者工具介绍》</a> 。</p>
<h2 id="1-3-小程序代码构成"><a href="#1-3-小程序代码构成" class="headerlink" title="1.3 小程序代码构成"></a>1.3 小程序代码构成</h2><h3 id="1-3-1-json-后缀的-JSON-配置文件"><a href="#1-3-1-json-后缀的-JSON-配置文件" class="headerlink" title="1.3.1.json 后缀的 JSON 配置文件"></a>1.3.1<code>.json</code> 后缀的 <code>JSON</code> 配置文件</h3><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#JSON 是一种数据格式，并不是编程语言，在小程序中，JSON扮演的静态配置的角色。</span></span><br><span class="line"></span><br><span class="line"><span class="string">我们可以看到在项目的根目录有一个</span> <span class="string">app.json</span> <span class="string">和</span> <span class="string">project.config.json，此外在</span> <span class="string">pages/logs</span> <span class="string">目录下还有一个</span> <span class="string">logs.json，我们依次来说明一下它们的用途</span></span><br></pre></td></tr></table></figure>

<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line">#小程序配置 app.json</span><br><span class="line">app.json 是当前小程序的全局配置，包括了小程序的所有页面路径、界面表现、网络超时时间、底部 tab 等。QuickStart 项目里边的 app.json 配置内容如下：</span><br><span class="line"></span><br><span class="line">&#123;</span><br><span class="line">  <span class="attr">"pages"</span>:[</span><br><span class="line">    <span class="string">"pages/index/index"</span>,</span><br><span class="line">    <span class="string">"pages/logs/logs"</span></span><br><span class="line">  ],</span><br><span class="line">  <span class="attr">"window"</span>:&#123;</span><br><span class="line">    <span class="attr">"backgroundTextStyle"</span>:<span class="string">"light"</span>,</span><br><span class="line">    <span class="attr">"navigationBarBackgroundColor"</span>: <span class="string">"#fff"</span>,</span><br><span class="line">    <span class="attr">"navigationBarTitleText"</span>: <span class="string">"WeChat"</span>,</span><br><span class="line">    <span class="attr">"navigationBarTextStyle"</span>:<span class="string">"black"</span></span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">我们简单说一下这个配置各个项的含义:</span><br><span class="line">    #pages字段 —— 用于描述当前小程序所有页面路径，这是为了让微信客户端知道当前你的小程序页面定义在哪个目录。</span><br><span class="line">    #window字段 —— 定义小程序所有页面的顶部背景颜色，文字颜色定义等。</span><br><span class="line">	其他配置项细节可以参考文档 小程序的配置 app.json 。</span><br><span class="line"></span><br><span class="line">#project.config.json 工具配置 </span><br><span class="line">	通常大家在使用一个工具的时候，都会针对各自喜好做一些个性化配置，例如界面颜色、编译配置等等，当你换了另外一台电脑重新安装工具的时候，你还要重新配置。</span><br><span class="line">	考虑到这点，小程序开发者工具在每个项目的根目录都会生成一个 project.config.json，你在工具上做的任何配置都会写入到这个文件，当你重新安装工具或者换电脑工作时，你只要载入同一个项目的代码包，开发者工具就自动会帮你恢复到当时你开发项目时的个性化配置，其中会包括编辑器的颜色、代码上传时自动压缩等等一系列选项。</span><br><span class="line">其他配置项细节可以参考文档 开发者工具的配置 。</span><br><span class="line"></span><br><span class="line">#page.json 页面配置 </span><br><span class="line">这里的 page.json 其实用来表示 pages/logs 目录下的 logs.json 这类和小程序页面相关的配置。</span><br><span class="line">	如果你整个小程序的风格是蓝色调，那么你可以在 app.json 里边声明顶部颜色是蓝色即可。实际情况可能不是这样，可能你小程序里边的每个页面都有不一样的色调来区分不同功能模块，因此我们提供了 page.json，让开发者可以独立定义每个页面的一些属性，例如刚刚说的顶部颜色、是否允许下拉刷新等等。</span><br><span class="line">其他配置项细节可以参考文档 页面配置 。</span><br><span class="line"></span><br><span class="line">#JSON 语法</span><br><span class="line">这里说一下小程序里JSON配置的一些注意事项。</span><br><span class="line">#JSON文件都是被包裹在一个大括号中 &#123;&#125;，通过key-value的方式来表达数据。JSON的Key必须包裹在一个双引号中，在实践中，编写 JSON 的时候，忘了给 Key 值加双引号或者是把双引号写成单引号是常见错误。</span><br><span class="line"></span><br><span class="line">JSON的值只能是以下几种数据格式，其他任何格式都会触发报错，例如 JavaScript 中的 undefined。</span><br><span class="line"></span><br><span class="line">    数字，包含浮点数和整数</span><br><span class="line">    字符串，需要包裹在双引号中</span><br><span class="line">    Bool值，true 或者 false</span><br><span class="line">    数组，需要包裹在方括号中 []</span><br><span class="line">    对象，需要包裹在大括号中 &#123;&#125;</span><br><span class="line">    Null</span><br><span class="line"></span><br><span class="line">还需要注意的是 JSON 文件中无法使用注释，试图添加注释将会引发报错。</span><br></pre></td></tr></table></figure>



<h3 id="1-3-2-wxml-后缀的-WXML-模板文件"><a href="#1-3-2-wxml-后缀的-WXML-模板文件" class="headerlink" title="1.3.2 .wxml 后缀的 WXML 模板文件"></a>1.3.2 <code>.wxml</code> 后缀的 <code>WXML</code> 模板文件</h3><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line">#WXML 模板</span><br><span class="line">从事过网页编程的人知道，网页编程采用的是 HTML + CSS + JS 这样的组合，其中 HTML 是用来描述当前这个页面的结构，CSS 用来描述页面的样子，JS 通常是用来处理这个页面和用户的交互。</span><br><span class="line"></span><br><span class="line">同样道理，在小程序中也有同样的角色，其中 WXML 充当的就是类似 HTML 的角色。打开 pages/index/index.wxml，你会看到以下的内容:</span><br><span class="line"></span><br><span class="line">&lt;view class="container"&gt;</span><br><span class="line">  &lt;view class="userinfo"&gt;</span><br><span class="line">    &lt;button wx:if="&#123;&#123;!hasUserInfo &amp;&amp; canIUse&#125;&#125;"&gt; 获取头像昵称 &lt;/button&gt;</span><br><span class="line">    &lt;block wx:else&gt;</span><br><span class="line">      &lt;image src="&#123;&#123;userInfo.avatarUrl&#125;&#125;" background-size="cover"&gt;&lt;/image&gt;</span><br><span class="line">      &lt;text class="userinfo-nickname"&gt;&#123;&#123;userInfo.nickName&#125;&#125;&lt;/text&gt;</span><br><span class="line">    &lt;/block&gt;</span><br><span class="line">  &lt;/view&gt;</span><br><span class="line">  &lt;view class="usermotto"&gt;</span><br><span class="line">    &lt;text class="user-motto"&gt;&#123;&#123;motto&#125;&#125;&lt;/text&gt;</span><br><span class="line">  &lt;/view&gt;</span><br><span class="line">&lt;/view&gt;</span><br><span class="line"></span><br><span class="line">和 HTML 非常相似，WXML 由标签、属性等等构成。但是也有很多不一样的地方，我们来一一阐述一下：</span><br><span class="line">    标签名字有点不一样</span><br><span class="line">    往往写 HTML 的时候，经常会用到的标签是 div, p, span，开发者在写一个页面的时候可以根据这些基础的标签组合出不一样的组件，例如日历、弹窗等等。换个思路，既然大家都需要这些组件，为什么我们不能把这些常用的组件包装起来，大大提高我们的开发效率。</span><br><span class="line"></span><br><span class="line">    从上边的例子可以看到，小程序的 WXML 用的标签是 view, button, text 等等，这些标签就是小程序给开发者包装好的基本能力，我们还提供了地图、视频、音频等等组件能力。</span><br><span class="line"></span><br><span class="line">   多了一些 wx:if 这样的属性以及 &#123;&#123; &#125;&#125; 这样的表达式</span><br><span class="line"></span><br><span class="line">    在网页的一般开发流程中，我们通常会通过 JS 操作 DOM (对应 HTML 的描述产生的树)，以引起界面的一些变化响应用户的行为。例如，用户点击某个按钮的时候，JS 会记录一些状态到 JS 变量里边，同时通过 DOM API 操控 DOM 的属性或者行为，进而引起界面一些变化。当项目越来越大的时候，你的代码会充斥着非常多的界面交互逻辑和程序的各种状态变量，显然这不是一个很好的开发模式，因此就有了 MVVM 的开发模式（例如 React, Vue），提倡把渲染和逻辑分离。简单来说就是不要再让 JS 直接操控 DOM，JS 只需要管理状态即可，然后再通过一种模板语法来描述状态和界面结构的关系即可。</span><br><span class="line"></span><br><span class="line">    小程序的框架也是用到了这个思路，如果你需要把一个 Hello World 的字符串显示在界面上。</span><br><span class="line"></span><br><span class="line">    WXML 是这么写 :</span><br><span class="line">    &lt;text&gt;&#123;&#123;msg&#125;&#125;&lt;/text&gt;</span><br><span class="line"></span><br><span class="line">    JS 只需要管理状态即可:</span><br><span class="line">    this.setData(&#123; msg: "Hello World" &#125;)</span><br><span class="line"></span><br><span class="line">    通过 &#123;&#123; &#125;&#125; 的语法把一个变量绑定到界面上，我们称为数据绑定。仅仅通过数据绑定还不够完整的描述状态和界面的关系，还需要 if/else, for等控制能力，在小程序里边，这些控制能力都用 wx: 开头的属性来表达。</span><br></pre></td></tr></table></figure>

<h3 id="1-3-3-wxss-后缀的-WXSS-样式文件"><a href="#1-3-3-wxss-后缀的-WXSS-样式文件" class="headerlink" title="1.3.3 .wxss 后缀的 WXSS 样式文件"></a>1.3.3 <code>.wxss</code> 后缀的 <code>WXSS</code> 样式文件</h3><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">#WXSS 样式</span><br><span class="line">	WXSS 具有 CSS 大部分的特性，小程序在 WXSS 也做了一些扩充和修改。</span><br><span class="line">    新增了尺寸单位。在写 CSS 样式时，开发者需要考虑到手机设备的屏幕会有不同的宽度和设备像素比，采用一些技巧来换算一些像素单位。WXSS 在底层支持新的尺寸单位 rpx ，开发者可以免去换算的烦恼，只要交给小程序底层来换算即可，由于换算采用的浮点数运算，所以运算结果会和预期结果有一点点偏差。</span><br><span class="line">    提供了全局的样式和局部样式。和前边 app.json, page.json 的概念相同，你可以写一个 app.wxss 作为全局样式，会作用于当前小程序的所有页面，局部页面样式 page.wxss 仅对当前页面生效。</span><br><span class="line">    此外 WXSS 仅支持部分 CSS 选择器</span><br></pre></td></tr></table></figure>

<h3 id="1-3-4-js-后缀的-JS-脚本逻辑文件"><a href="#1-3-4-js-后缀的-JS-脚本逻辑文件" class="headerlink" title="1.3.4 .js 后缀的 JS 脚本逻辑文件"></a>1.3.4 <code>.js</code> 后缀的 <code>JS</code> 脚本逻辑文件</h3><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">#JS 逻辑交互</span><br><span class="line"></span><br><span class="line">一个服务仅仅只有界面展示是不够的，还需要和用户做交互：响应用户的点击、获取用户的位置等等。在小程序里边，我们就通过编写 JS 脚本文件来处理用户的操作。</span><br><span class="line"></span><br><span class="line">&lt;view&gt;&#123;&#123; msg &#125;&#125;&lt;/view&gt;</span><br><span class="line">&lt;button bindtap="clickMe"&gt;点击我&lt;/button&gt;</span><br><span class="line"></span><br><span class="line">点击 button 按钮的时候，我们希望把界面上 msg 显示成 "Hello World"，于是我们在 button 上声明一个属性: bindtap ，在 JS 文件里边声明了 clickMe 方法来响应这次点击操作：</span><br><span class="line"></span><br><span class="line">Page(&#123;</span><br><span class="line">  clickMe: function() &#123;</span><br><span class="line">    this.setData(&#123; msg: "Hello World" &#125;)</span><br><span class="line">  &#125;</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line">响应用户的操作就是这么简单，更详细的事件可以参考文档 WXML - 事件 。</span><br><span class="line"></span><br><span class="line">此外你还可以在 JS 中调用小程序提供的丰富的 API，利用这些 API 可以很方便的调起微信提供的能力，例如获取用户信息、本地存储、微信支付等。在前边的 QuickStart 例子中，在 pages/index/index.js 就调用了 wx.getUserInfo 获取微信用户的头像和昵称，最后通过 setData 把获取到的信息显示到界面上。更多 API 可以参考文档 小程序的API 。</span><br></pre></td></tr></table></figure>



<h2 id="1-4-目录结构"><a href="#1-4-目录结构" class="headerlink" title="1.4 目录结构"></a>1.4 目录结构</h2><p>小程序包含一个描述整体程序的 <code>app</code> 和多个描述各自页面的 <code>page</code>。一个小程序主体部分由三个文件组成，必须放在项目的根目录，如下：</p>
<table>
<thead>
<tr>
<th>文件</th>
<th>必需</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td><a href="https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/app.html" target="_blank" rel="noopener">app.js</a></td>
<td>是</td>
<td>小程序逻辑</td>
</tr>
<tr>
<td><a href="https://developers.weixin.qq.com/miniprogram/dev/framework/config.html" target="_blank" rel="noopener">app.json</a></td>
<td>是</td>
<td>小程序公共配置</td>
</tr>
<tr>
<td><a href="https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxss.html" target="_blank" rel="noopener">app.wxss</a></td>
<td>否</td>
<td>小程序公共样式表</td>
</tr>
</tbody></table>
<h3 id="1-4-1-app-js文件"><a href="#1-4-1-app-js文件" class="headerlink" title="1.4.1 app.js文件"></a>1.4.1 app.js文件</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">#每个小程序都需要在 app.js 中调用 App 方法注册小程序实例，绑定生命周期回调函数、错误监听和页面不存在监听函数等。详细的参数含义和使用请参考 App 参考文档 。</span><br><span class="line"></span><br><span class="line"><span class="comment">// app.js</span></span><br><span class="line">App(&#123;</span><br><span class="line">  onLaunch (options) &#123;</span><br><span class="line">    <span class="comment">// Do something initial when launch.</span></span><br><span class="line">  &#125;,</span><br><span class="line">  onShow (options) &#123;</span><br><span class="line">    <span class="comment">// Do something when show.</span></span><br><span class="line">  &#125;,</span><br><span class="line">  onHide () &#123;</span><br><span class="line">    <span class="comment">// Do something when hide.</span></span><br><span class="line">  &#125;,</span><br><span class="line">  onError (msg) &#123;</span><br><span class="line">    <span class="built_in">console</span>.log(msg)</span><br><span class="line">  &#125;,</span><br><span class="line">  globalData: <span class="string">'I am global data'</span></span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line">#整个小程序只有一个 App 实例，是全部页面共享的。开发者可以通过 getApp 方法获取到全局唯一的 App 实例，获取App上的数据或调用开发者注册在 App 上的函数。</span><br><span class="line"></span><br><span class="line"><span class="comment">// xxx.js</span></span><br><span class="line"><span class="keyword">const</span> appInstance = getApp()</span><br><span class="line"><span class="built_in">console</span>.log(appInstance.globalData) <span class="comment">// I am global data</span></span><br></pre></td></tr></table></figure>

<h3 id="1-4-2-app-json-文件"><a href="#1-4-2-app-json-文件" class="headerlink" title="1.4.2 app.json 文件"></a>1.4.2 app.json 文件</h3><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line">#小程序根目录下的 app.json 文件用来对微信小程序进行全局配置，决定页面文件的路径、窗口表现、设置网络超时时间、设置多 tab 等。完整配置项说明请参考小程序全局配置</span><br><span class="line"></span><br><span class="line">以下是一个包含了部分常用配置选项的 app.json ：</span><br><span class="line">&#123;</span><br><span class="line">  <span class="attr">"pages"</span>: [</span><br><span class="line">    <span class="string">"pages/index/index"</span>,</span><br><span class="line">    <span class="string">"pages/logs/index"</span></span><br><span class="line">  ],</span><br><span class="line">  <span class="attr">"window"</span>: &#123;</span><br><span class="line">    <span class="attr">"navigationBarTitleText"</span>: <span class="string">"Demo"</span></span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="attr">"tabBar"</span>: &#123;</span><br><span class="line">    <span class="attr">"list"</span>: [&#123;</span><br><span class="line">      <span class="attr">"pagePath"</span>: <span class="string">"pages/index/index"</span>,</span><br><span class="line">      <span class="attr">"text"</span>: <span class="string">"首页"</span></span><br><span class="line">    &#125;, &#123;</span><br><span class="line">      <span class="attr">"pagePath"</span>: <span class="string">"pages/logs/index"</span>,</span><br><span class="line">      <span class="attr">"text"</span>: <span class="string">"日志"</span></span><br><span class="line">    &#125;]</span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="attr">"networkTimeout"</span>: &#123;</span><br><span class="line">    <span class="attr">"request"</span>: <span class="number">10000</span>,</span><br><span class="line">    <span class="attr">"downloadFile"</span>: <span class="number">10000</span></span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="attr">"debug"</span>: <span class="literal">true</span>,</span><br><span class="line">  <span class="attr">"navigateToMiniProgramAppIdList"</span>: [</span><br><span class="line">    <span class="string">"wxe5f52902cf4de896"</span></span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br><span class="line">完整配置项说明请参考小程序全局配置</span><br></pre></td></tr></table></figure>



<p>一个小程序页面由四个文件组成，分别是：</p>
<table>
<thead>
<tr>
<th>文件类型</th>
<th>必需</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td><a href="https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/page.html" target="_blank" rel="noopener">js</a></td>
<td>是</td>
<td>页面逻辑</td>
</tr>
<tr>
<td><a href="https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxml/" target="_blank" rel="noopener">wxml</a></td>
<td>是</td>
<td>页面结构</td>
</tr>
<tr>
<td><a href="https://developers.weixin.qq.com/miniprogram/dev/framework/config.html#页面配置" target="_blank" rel="noopener">json</a></td>
<td>否</td>
<td>页面配置</td>
</tr>
<tr>
<td><a href="https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxss.html" target="_blank" rel="noopener">wxss</a></td>
<td>否</td>
<td>页面样式表</td>
</tr>
</tbody></table>
<p><strong>注意：为了方便开发者减少配置项，描述页面的四个文件必须具有相同的路径与文件名。</strong></p>
<h2 id="1-5-允许上传的文件"><a href="#1-5-允许上传的文件" class="headerlink" title="1.5 允许上传的文件"></a>1.5 允许上传的文件</h2><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#在项目目录中，以下文件会经过编译，因此上传之后无法直接访问到：*.js、app.json、*.wxml、*.wxss（其中 wxml 和 wxss 文件仅针对在 app.json 中配置了的页面）。除此之外，只有后缀名在白名单内的文件可以被上传，不在白名单列表内文件在开发工具能被访问到，但无法被上传。具体白名单列表如下：</span></span><br><span class="line"></span><br><span class="line"><span class="number">1</span><span class="string">.</span> <span class="string">wxs</span></span><br><span class="line"><span class="number">2</span><span class="string">.</span> <span class="string">png</span></span><br><span class="line"><span class="number">3</span><span class="string">.</span> <span class="string">jpg</span></span><br><span class="line"><span class="number">4</span><span class="string">.</span> <span class="string">jpeg</span></span><br><span class="line"><span class="number">5</span><span class="string">.</span> <span class="string">gif</span></span><br><span class="line"><span class="number">6</span><span class="string">.</span> <span class="string">svg</span></span><br><span class="line"><span class="number">7</span><span class="string">.</span> <span class="string">json</span></span><br><span class="line"><span class="number">8</span><span class="string">.</span> <span class="string">cer</span></span><br><span class="line"><span class="number">9</span><span class="string">.</span> <span class="string">mp3</span></span><br><span class="line"><span class="number">10</span><span class="string">.</span> <span class="string">aac</span></span><br><span class="line"><span class="number">11</span><span class="string">.</span> <span class="string">m4a</span></span><br><span class="line"><span class="number">12</span><span class="string">.</span> <span class="string">mp4</span></span><br><span class="line"><span class="number">13</span><span class="string">.</span> <span class="string">wav</span></span><br><span class="line"><span class="number">14</span><span class="string">.</span> <span class="string">ogg</span></span><br><span class="line"><span class="number">15</span><span class="string">.</span> <span class="string">silk</span></span><br></pre></td></tr></table></figure>

<h1 id="三-遇到问题记录"><a href="#三-遇到问题记录" class="headerlink" title="三. 遇到问题记录"></a>三. 遇到问题记录</h1><h2 id="1-更换域名注意事项"><a href="#1-更换域名注意事项" class="headerlink" title="1.更换域名注意事项"></a>1.更换域名注意事项</h2><h3 id="1-1-域名方面"><a href="#1-1-域名方面" class="headerlink" title="1.1  域名方面"></a>1.1  域名方面</h3><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 1.域名需要提前备案</span></span><br><span class="line"><span class="comment"># 2.域名解析的服务器需正确安装ssl证书（微信使用https）</span></span><br><span class="line"><span class="comment"># 3.域名解析尽量不免www.xxx.xx，可改用api.xxxx.xx 等格式，避免出错（阿里云www解析的添加免费证书审核很慢）</span></span><br></pre></td></tr></table></figure>

<h3 id="1-2-微信平台方面"><a href="#1-2-微信平台方面" class="headerlink" title="1.2  微信平台方面"></a>1.2  微信平台方面</h3><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 1.微信平台每个月允许修改域名5次，注意修改次数</span></span><br><span class="line"><span class="comment"># 2.微信平台配置的域名强制https</span></span><br><span class="line"><span class="comment"># 3.修改完域名后，需等待一段时间（半小时左右）正式版本的访问才可用</span></span><br><span class="line"><span class="comment"># 4.修改完后立即测试需打开调试模式（调试模式可不检查域名的合法性，ssl等）</span></span><br></pre></td></tr></table></figure>


    </div>

    
    
    

      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/04/11/spring-boot%E5%AD%A6%E4%B9%A0%E6%8A%A5%E9%94%99%E8%AE%B0%E5%BD%95/" rel="prev" title="spring-boot学习报错记录">
      <i class="fa fa-chevron-left"></i> spring-boot学习报错记录
    </a></div>
      <div class="post-nav-item"></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#微信小程序开发记录"><span class="nav-number">1.</span> <span class="nav-text">微信小程序开发记录</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#前言"><span class="nav-number"></span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#一-小程序与普通网页开发的区别"><span class="nav-number"></span> <span class="nav-text">一. 小程序与普通网页开发的区别</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#二-准备"><span class="nav-number"></span> <span class="nav-text">二. 准备</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-1-小程序帐号"><span class="nav-number"></span> <span class="nav-text">1.1 小程序帐号</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#1-2-开发工具"><span class="nav-number"></span> <span class="nav-text">1.2 开发工具</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#1-3-小程序代码构成"><span class="nav-number"></span> <span class="nav-text">1.3 小程序代码构成</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-1-json-后缀的-JSON-配置文件"><span class="nav-number">1.</span> <span class="nav-text">1.3.1.json 后缀的 JSON 配置文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-2-wxml-后缀的-WXML-模板文件"><span class="nav-number">2.</span> <span class="nav-text">1.3.2 .wxml 后缀的 WXML 模板文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-3-wxss-后缀的-WXSS-样式文件"><span class="nav-number">3.</span> <span class="nav-text">1.3.3 .wxss 后缀的 WXSS 样式文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-4-js-后缀的-JS-脚本逻辑文件"><span class="nav-number">4.</span> <span class="nav-text">1.3.4 .js 后缀的 JS 脚本逻辑文件</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#1-4-目录结构"><span class="nav-number"></span> <span class="nav-text">1.4 目录结构</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-4-1-app-js文件"><span class="nav-number">1.</span> <span class="nav-text">1.4.1 app.js文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-4-2-app-json-文件"><span class="nav-number">2.</span> <span class="nav-text">1.4.2 app.json 文件</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#1-5-允许上传的文件"><span class="nav-number"></span> <span class="nav-text">1.5 允许上传的文件</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#三-遇到问题记录"><span class="nav-number"></span> <span class="nav-text">三. 遇到问题记录</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-更换域名注意事项"><span class="nav-number"></span> <span class="nav-text">1.更换域名注意事项</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-域名方面"><span class="nav-number">1.</span> <span class="nav-text">1.1  域名方面</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-微信平台方面"><span class="nav-number">2.</span> <span class="nav-text">1.2  微信平台方面</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="SeowonByeong"
      src="/images/avatar01.jpeg">
  <p class="site-author-name" itemprop="name">SeowonByeong</p>
  <div class="site-description" itemprop="description">勿忘初心 方得始终</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">5</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/SeoWonByeong" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;SeoWonByeong" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:546822948@qq.com" title="E-Mail → mailto:546822948@qq.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://seowonbyeong.gitee.io/" title="http:&#x2F;&#x2F;seowonbyeong.gitee.io">博客</a>
        </li>
    </ul>
  </div>

<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=26908739&auto=1&height=66"></iframe>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">SeowonByeong</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://mist.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
/* 鼠标特效 */
var a_idx = 0;
jQuery(document).ready(function($) {
$("body").click(function(e) {
var a = new Array("❤富强❤","❤民主❤","❤文明❤","❤和谐❤","❤自由❤","❤平等❤","❤公正❤","❤法治❤","❤爱国❤","❤敬业❤","❤诚信❤","❤友善❤");
var $i = $("<span></span>").text(a[a_idx]);
a_idx = (a_idx + 1) % a.length;
var x = e.pageX,
y = e.pageY;
$i.css({
"z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
"top": y - 25,
"left": x - 25,
"position": "absolute",
"font-weight": "bold",
"color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
});
$("body").append($i);
$i.animate({
"top": y - 180,
"opacity": 0
},
1500,
function() {
$i.remove();
});
});
});
</script>


        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user">访客:</i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye">浏览:</i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  

</body>
</html>
